Time series search phrase processing

ABSTRACT

Methods and apparatus consistent with the invention provide the ability to organize, index, search, and present time series data based on searches. Time series data are sequences of time stamped records occurring in one or more usually continuous streams, representing some type of activity. In one embodiment, time series data is stored as discrete events time stamps. A search is received and relevant event information is retrieved based in whole or in part on the time stamp, a keyword indexing mechanism, or statistical indices calculated at the time of the search.

RELATED APPLICATIONS

The present application is a continuation of U.S. patent applicationSer. No. 17/125,807, filed Dec. 17, 2020, which is a continuation ofU.S. patent application Ser. No. 15/963,740, filed Apr. 26, 2018; whichis a continuation of U.S. patent application Ser. No. 15/661,260, filedon Jul. 27, 2017; which is a continuation of U.S. patent applicationSer. No. 15/420,938, filed on Jan. 31, 2017; which is a continuation ofU.S. patent application Ser. No. 14/611,170, filed on Jan. 30, 2015;which is a continuation of U.S. patent application Ser. No. 13/353,135,filed on Jan. 18, 2012; which is a continuation of U.S. patentapplication Ser. No. 11/868,370, filed Oct. 5, 2007; which claimspriority under 35 U.S.C. § 119(e) to U.S. Provisional Patent ApplicationNo. 60/828,283, filed Oct. 5, 2006. The subject matter of all of theforegoing is incorporated herein by reference in its entirety.

BACKGROUND Field

This invention relates generally to information organization, search,and retrieval and more particularly to time series data organization,search, and retrieval.

Description of the Related Art

Time series data are sequences of time stamped records occurring in oneor more usually continuous streams, representing some type of activitymade up of discrete events. Examples include information processinglogs, market transactions, and sensor data from real-time monitors(supply chains, military operation networks, or security systems). Theability to index, search, and present relevant search results isimportant to understanding and working with systems emitting largequantities of time series data.

Existing large scale search engines (e.g., Google and Yahoo web search)are designed to address the needs of less time sensitive types of dataand are built on the assumption that only one state of the data needs tobe stored in the index repository, for example, URLs in a Web searchindex, records in a customer database, or documents as part of a filesystem. Searches for information generally retrieve only a single copyof information based on keyword search terms: a collection of URLs froma Website indexed a few days ago, customer records from close ofbusiness yesterday, or a specific version of a document.

In contrast, consider an example of time series data from a typicalinformation processing environment, shown in FIG. 1 . Firewalls,routers, web servers, application servers and databases constantlygenerate streams of data in the form of events occurring perhapshundreds or thousands of times per second. Here, historical data valueand the patterns of data behavior over time are generally as importantas current data values. Existing search solutions generally have littlenotion of time-based indexing, searching or relevancy in thepresentation of results and don't meet the needs of time series data.

Compared to full text search engines, which organize their indices sothat retrieving documents with the highest relevance scores is mostefficient, an engine for searching time series data preferably wouldorganize the index so that access to various time ranges, including lessrecent time ranges, is efficient. For example, unlike for many modemsearch engines, there may be significantly less benefit for a timeseries search engine to cache the top 1000 results for a particularkeyword.

On the other hand, given the repetitive nature of time series data,opportunities for efficiency of index construction and searchoptimization are available. However, indexing time series data isfurther complicated because the data can be collected from multiple,different sources asynchronously and out of order. Streams of data fromone source may be seconds old and data from another source may beinterleaved with other sources or may be days, weeks, or months olderthan other sources. Moreover, data source times may not be in sync witheach other, requiring adjustments in time offsets post indexing.Furthermore, time stamps can have an almost unlimited number of formatsmaking identification and interpretation difficult. Time stamps withinthe data can be hard to locate, with no standard for location, format,or temporal granularity (e.g., day, hour, minute, second, sub-second).

Searching time series data typically involves the ability to restrictsearch results efficiently to specified time windows and othertime-based metadata such as frequency, distribution of inter-arrivaltime, and total number of occurrences or class of result. Keyword-basedsearching is generally secondary in importance but can be powerful whencombined with time-based search mechanisms. Searching time series datarequires a whole new way to express searches. Search engines today allowusers to search by the most frequently occurring terms or keywordswithin the data and generally have little notion of time basedsearching. Given the large volume and repetitive characteristics of timeseries data, users often need to start by narrowing the set of potentialsearch results using time-based search mechanisms and then, throughexamination of the results, choose one or more keywords to add to theirsearch parameters. Timeframes and time-based metadata like frequency,distribution, and likelihood of occurrence are especially important whensearching time series data, but difficult to achieve with current searchengine approaches. Try to find, for example, all stories referring tothe “Space Shuttle” between the hours of 10 AM and 11 AM on May 10, 2005or the average number of “Space Shuttle” stories per hour the same daywith a Web-based search engine of news sites. With a focus on when datahappens, time-based search mechanisms and queries can be useful forsearching time series data.

Some existing limited applications of time-based search exist inspecific small-scale domains. For example, e-mail search is availabletoday in many mainstream email programs and web-based email services.However, searches are limited to simple time functions like before,after, or time ranges; the data sets are generally small scale andhighly structured from a single domain; and the real-time indexingmechanisms are append only, usually requiring the rebuilding of theentire index to interleave new data.

Also unique to the cyclicality of time series data is the challenge ofpresenting useful results. Traditional search engines typically presentresults ranked by popularity and commonality. Contrary to this, for timeseries data, the ability to focus on data patterns and infrequentlyoccurring, or unusual results may be important. To be useful, timeseries search results preferably would have the ability to be organizedand presented by time-based patterns and behaviors. Users need theability to see results at multiple levels of granularity (e.g., seconds,minutes, hours, days) and distribution (e.g., unexpected or leastfrequently occurring) and to view summary information reflectingpatterns and behaviors across the result set. Existing search engines,on the other hand, generally return text results sorted by key worddensity, usage statistics, or links to or from documents and Web pagesin attempts to display the most popular results first.

In one class of time series search engine, it would be desirable for theengine to index and allow for the searching of data in real-time. Anydelay between the time data is collected and the time it is available tobe searched is to be minimized. Enabling real-time operation againstlarge, frequently changing data sets can be difficult with traditionallarge-scale search engines that optimize for small search response timesat the expense of rapid data availability. For example, Web and documentsearch engines typically start with a seed and crawl to collect datauntil a certain amount of time elapses or a collection size is reached.A snapshot of the collection is saved and an index is built, optimized,and stored. Frequently accessed indices are then loaded into a cachingmechanism to optimize search response time. This process can take hoursor even days to complete depending on the size of the data set anddensity of the index. Contrast this with a real-time time seriesindexing mechanism designed to minimize the time between when data iscollected and when the data is available to be searched. The ability toinsert, delete and reorganize indices, on the fly as data is collected,without rebuilding the index structure is essential to indexing timeseries data and providing real-time search results for this class oftime series search engines.

Other software that is focused on time series, e.g., log event analyzerssuch as Sawmill or Google's Sawzall can provide real-time analysiscapabilities but are not search engines per se because they do notprovide for ad hoc searches. Reports must be defined and built inadvance of any analysis. Additionally, no general keyword-based ortime-based search mechanisms are available. Other streaming dataresearch projects (including the Stanford Streams project and productsfrom companies like StreamBase Systems) can also produce analysis andalerting of streaming data but do not provide any persistence of data,indexing, time-based, or keyword-based searching.

There exists, therefore, a need to develop other techniques forindexing, searching and presenting search results from time series data.

SUMMARY

Methods and apparatus consistent with the invention address these andother needs by allowing for the indexing, searching, and retrieval oftime series data using a time series search engine (TSSE). In oneimplementation, one aspect of TSSEs is the use of time as a primarymechanism for indexing, searching, and/or presentation of searchresults. A time series search language (TSSL) specific to time-basedsearch mechanisms is used to express searches in human readable form andresults are presented using relevancy algorithms specific to time seriesdata. Search expression and results presentation are based on keyconcepts important to searching time series data including but notlimited to time windows, frequency, distribution, patterns ofoccurrences, and related time series data points from multiple,disparate sources.

In one aspect of the invention, multiple sources of time series data areorganized and indexed for searching and results are presented upon useror machine initiated searches. In another aspect, a time series searchengine (TSSE) includes four parts: (1) a time stamp process; (2) anindexing process; (3) a search process; and (4) a results presentationprocess.

In one aspect of the invention, a computer-implemented method for timesearching data includes the following steps. Time series data streamsare received. One example of time series data streams includes serverlogs and other types of machine data (i.e., data generated by machines).The time series data streams are time stamped to create time stampedevents. The time stamped events are time indexed to create time bucketedindices, which are used to fulfill search requests. Time series searchrequest are executed, at least in part, by searching the time bucketedindices.

In certain implementations, time stamping the time series data streamsincludes aggregating the time series data streams into events and timestamping the events. For example, the events may be classified by domainand then time stamped according to their domain. In one approach, forevents that are classified in a domain with a known time stamp format,the time stamp is extracted from the event. However, for events that arenot classified in a domain with a known time stamp format, the timestamp is interpolated.

In another aspect of the invention, time bucketed indices are created byassigning the time stamped events to time buckets according to theirtime stamps. Different bucket policies can be used. For example, thetime buckets may all have the same time duration, or may have differenttime durations. In addition, time buckets may be instantiated using alazy allocation policy. The time stamped events may also be segmented,and the segments used to determine time bucket indices. Various forms ofindexing, including hot indexing, warm indexing and speculativeindexing, may also be used.

The creation of time bucket indices facilitates the execution of timeseries searches. In one approach, a time series search request isdivided into different sub-searches for the affected time buckets, witheach sub-search executed across the corresponding time bucket index.

Other aspects of the invention include software, computer systems andother devices corresponding to the methods described above, andapplications for all of the foregoing.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention has other advantages and features which will be morereadily apparent from the following detailed description of theinvention and the appended claims, when taken in conjunction with theaccompanying drawings, in which:

FIG. 1 (prior art) is a diagram of time series data environments.

FIG. 2 is a diagram of a time series search engine according to theinvention.

FIG. 3 is a diagram of a time stamp process suitable for use with thetime series search engine of FIG. 2 .

FIG. 4 is a diagram of an event aggregation process suitable for usewith the time stamp process of FIG. 3 .

FIG. 5 is a diagram of an indexing process suitable for use with thetime series search engine of FIG. 2 .

FIG. 6 is a diagram of a search process suitable for use with the timeseries search engine of FIG. 2 .

FIG. 7 is a diagram of a results presentation process suitable for usewith the time series search engine of FIG. 2 .

The figures depict embodiments of the present invention for purposes ofillustration only. One skilled in the art will readily recognize fromthe following discussion that alternative embodiments of the structuresand methods illustrated herein may be employed without departing fromthe principles of the invention described herein.

DETAILED DESCRIPTION

FIG. 1 illustrates different examples of time series data environmentswith potentially large numbers of data sources and streams of timeseries data across multiple domains. In this figure, the first picturerepresents an information-processing environment with time series datafrom web servers, application servers, and databases in the form ofserver logs. The second picture is a typical market-trading environmentwith transactions between multiple buyers and sellers and between two ormore markets. Time series data is generated in the form of transactionrecords representing the intention or trade or the final settlement ofthe trade as examples. In the third picture, a real-time monitoringenvironment is depicted with multiple sensors producing time series datain the form of recorded measurements. All three of these environmentsare examples of potential applications for the TSSE.

Aspects of the invention will be described with respect to the firstpicture in FIG. 1 , the information-processing environment, but theinvention can also be used with other time series data environments andapplications including the other environments shown in FIG. 1 .

FIG. 2 illustrates one approach 200 to architecting a TSSE. Time seriesdata streams 205 arrive synchronously or asynchronously from multiplesources, multiple searches 255 are expressed by users and/or othersystems, and results sets 275 are presented through a variety ofmechanisms including, for example, application programming interfacesand web-based user interfaces.

The arrival of time series data streams 205 at the TSSE 200 can beeffected by having the TSSE gather them directly or by having auser-supplied script collect, preprocess, and deliver them to a defaultTSSE collection point. This architecture preferably tolerates dataarriving late and temporally out of order. Currently, most sources oftime series data are not designed for sophisticated processing of thedata, so the TSSE typically will collect or be fed raw time series datathat are close to their native form. The TSSE can be situated indifferent locations so long as it has access to the time series data.For example, one copy of the TSSE can be run on a single centralcomputer or multiple copies can be configured in a peer-to-peer set-upwith each copy working on the same time series data streams or differenttime series data streams.

FIG. 2 depicts an example TSSE 200 with four major processes: time stampprocess 210, index process 220, search process 230 and presentationprocess 240. The time stamp process 210 turns raw time series data 205into time stamped events 215 to be fed to the indexing process 220.Following our information processing example, raw logs 205 from multipleweb servers, application servers and databases might be processed by thetime stamp process 210 to identify individual events 215 within thevarious log formats and properly extract time and other event data. Theevent data 215 is used by the index process 220 to build time bucketedindices 225 of the events. These indices 225 are utilized by the searchprocess 230 which takes searches 255 from users or systems, decomposesthe searches, and then executes a search across a set of indices.

For example, a user might want to locate all the events from aparticular web server and a particular application server occurringwithin the last hour and which contain a specific IP address. Inaddition, the search process 230 may choose to initiate the creation ofmeta events 237 at search time to handle time-based and statisticalsummary indices useful in searching through repetitive, temporal data.For example, meta events 237 may represent averages, means, or counts ofactual events or more sophisticated pattern based behavior. In this casea user might want to search to find all the events occurring with afrequency of three per minute.

Upon completion, the search process 230 hands results from the selectedindices 235 to the presentation process 240 which merges result sets,ranks results, and feeds the results 275 to an API or user interface forpresentation.

Time Stamp Process

Process 210 shown in FIG. 2 of an exemplary implementation 200 of a TSSEis to acquire streaming time series data, identify individual eventswithin the stream, and assign time stamps to each event. An example timestamp process 210 block diagram is shown in FIG. 3 and includes severalsteps including event aggregation 310, domain identification 320, timeextraction 330, and time interpolation 340. Time series data streams 205are received as input to the time stamp process 210 and then processedinto individual time stamped events 215.

Event Aggregation

Step 310 in the time stamp process 210 of FIG. 3 aggregates thestreaming time series data 205 into individual events 315. In ourinformation-processing example, web server time series data streams mayhave a single line per event and be easy to identify. However, anapplication server time series data stream may contain single eventswith a large number of lines making identification of individual eventswithin the stream difficult.

In one implementation, event aggregation 310 uses feature extraction(e.g., leading punctuation, significant words, white space, and breakingcharacters) and machine learning algorithms to determine where the eventboundaries are. FIG. 4 is a diagram of an event aggregation processsuitable for use with the time stamp process of FIG. 3 .

Source Identification—Classification into Domains

Given the repetitive, yet dynamic, nature of the time series data 205 inour information processing example (which data will be referred to asmachine data 205 or MD 205), an effective aggregation process 310 (suchas shown in FIG. 4 ) preferably will learn about data formats andstructure automatically. In one implementation, learning is separatedinto different domains based on the source of MD 205. Domains can begeneral system types, such as log files, message bus traffic, andnetwork management data, or specific types, such as output of a givenapplication or technology—Sendmail logging data, Oracle database auditdata, and J2EE messaging.

In this example event aggregation process 310, the domain for a givensource of MD is identified 415 so that domain specific organizationmethods can be applied. Domains are determined through a learningprocess. The learning process uses collections of MD from well-knowndomains as input and creates a source signature 412 for each domain. Inone implementation, source signatures 412 are generated fromrepresentative samples of MD 205 by creating a hash table mappingpunctuation characters to their frequency. While tokens and token valuescan change in MD collection, in this particular implementation, thesignature 412 generated by the frequency of punctuation is quite stable,and reliable within a specific domain. Other implementations could usefunctions of the punctuation and tokens, such as the frequencies of thefirst punctuation character on a line, or the first capitalized term ona line. Given that source signatures 412 can be large and hard to read,signatures can have a corresponding label in the form of a number ortext that can be machine generated or human assigned. For example, thesource signature 412 for an Apache web server log might beprogrammatically assigned the label “205”, or a user can assign thelabel “Apache Server Log”.

In one embodiment, clustering is used to classify 415 collected MD 205into domains according to their source signatures 412. As collections ofMD 205 are encountered, each collection's signature is matched to theset of known source signatures 412 by performing a nearest-neighborsearch. If the distance of the closest matching signature 412 is withina threshold, the closest matching signature 420's domain is assumed tobe the domain of the source. If no best match can be found, a new sourcesignature 412 can be created from the sample signature and a new sourcedomain created. Alternatively, a default source domain can be used. Inone implementation, the distance between two signatures is calculated byiterating over the union of attributes of the two signatures, with thetotal signature distance being the average of distances for eachattribute. For each attribute A, the value of A on Signature1 andSignature2, V1 and V2, are compared and a distance is calculated. Thedistance for attribute A is the square of (V1−V2)*IDF, where IDF is thelog(N/|A|), where N is the number of signatures, and |A| is the numberof signatures with attribute A.

Source Identification—Classification as Text/Binary

Some MD 205 sources are non-textual or binary and cannot be easilyprocessed unless a known process is available to convert the binary MDinto textual form. To classify a source as textual or binary, a sampleMD collection is analyzed. Textual MD can also have embedded binary MD,such as a memory dump, and the classification preferably identifies itas such. In one implementation, the textual/binary classification worksas follows. The sample is a set of lines of data, where a line isdefined as the data between new lines (i.e., ‘\n’), carriage returns(i.e., ‘\r’), or their combination (i.e., ‘\r\n’). For each line, if theline's length is larger than some large threshold, such as 2kcharacters, or if the line contains a character with an ASCII value ofzero (0), a count of Binary-looking lines is incremented. Otherwise, ifthe line's length is shorter than a length that one would expect mosttext lines to be below, such as 256 characters, a count of Text-lookinglines is incremented. If the number of Text-looking lines is twice asnumerous as the Binary-looking lines (other ratios can be used dependingon the context), the source is classified as text. Otherwise, the sourceis classified as binary.

Aggregation of Machine Data into Raw Events

When the source signature 420 for a collection of MD has been identified415, the corresponding aggregation rules are applied 425 to the MDcollection. Aggregation rules describe the manner in which MD 205, froma particular domain, is organized 425 into event data 315 by identifyingthe boundaries of events within a collection of MD, for example, how tolocate a discrete event by finding its beginning and ending. In oneimplementation, the method of aggregation 425 learns, without priorknowledge, by grouping together multiple lines from a sample of MD 205.Often MD 205 contains events 315 that are anywhere from one to hundredsof lines long that are somehow logically grouped together.

The MD collection may be known a priori, or may be classified, assingle-line type (i.e., containing only single-line events) ormulti-line type (i.e., possibly containing multi-line events) prior toperforming aggregation. For those MD collections that are classified assingle line type, aggregation 425 is simple-single-line type MDcollections are broken on each line as a separate event. Multi-line typeMD collections are processed 425 for aggregation. In one implementation,a MD collection is classified as a multi-line type if 1) there is alarge percentage of lines that start with spaces or are blank (e.g., ifmore than 5% of the lines start with spaces or are blank), or 2) thereare too many varieties of punctuation characters in the first Npunctuation characters. For example, if the set of the first threepunctuation characters found on each line has more than five patterns(e.g., ‘:::’, ‘!:!’, ‘,,,’, ‘:..’, ‘( )*’), the collection might beclassified as multi-line.

Another aspect of aggregation methods 425 is the ability to learn, andcodify into rules, what constitutes a break between lines and thereforethe boundary between events, by analyzing a sample of MD. For example,in one implementation, an aggregation method 425 compares every two-linepair looking for statistically similar structures (e.g., use of whitespace, indentation, and time-stamps) to quickly learn which two belongtogether and which two are independent. In one implementation,aggregation 425 works as follows. For each line, first check if the linestarts with a time-stamp. If so, then break. Typically, lines startingwith a time-stamp are the start of a new event. For lines that do notstart with a time-stamp, combine the current line with the prior line tosee how often the pair of lines occurs, one before the other, as apercentage of total pairs in the MD sample. Line signatures are used inplace of lines, where a line signature is a more stable version of aline, immune to simple numeric and textual changes. In thisimplementation, signatures can be created by converting a line into astring that is the concatenation of leading white space, any punctuationon the line, and the first word on the line. The line “10:29:03 Host191.168.0.1 rebooting:normally” is converted to “:: . . . :Host.”

Now this current line signature can be concatenated with the previousline signature (i.e., signature1 combined with signature2) and used as acombined key into a table of break rules. The break rule table maps thecombined key to a break rule, which determines whether there should be a‘break’, or not, between the two lines (i.e., whether they are part ofdifferent events or not). Break rules can have confidence levels, and amore confident rule can override a less confident rule. Break rules canbe created automatically by analyzing the co-occurrence data of the twolines and what percent of the time their signatures occur adjacently. Ifthe two line signatures highly co-occur, a new rule would recommend nobreak between them. Alternatively, if they rarely co-occur, a new rulewould recommend a break between them. For example, if line signature Ais followed by line signature B greater than 20% of the time A is seen,then a break rule might be created to recommend no break between them.Rules can also be created based on the raw number of line signaturesthat follow/proceed another line signature. For example, if a linesignature is followed by say, ten different line signatures, create arule that recommends a break between them. If there is no break rule inthe break rule table, the default behavior is to break and assume thetwo lines are from different events. Processing proceeds by processingeach two-line pair, updating line signature and co-occurrencestatistics, and applying and learning corresponding break rules. Atregular intervals, the break rule table is written out to the hard diskor permanent storage.

Time Stamp Identification

Once the incoming time series stream 205 has been aggregated 310 intoindividual events 315, the events and their event data are input into atime stamp identification step 320 which determines whether or not thetime series event data contains tokens that indicate a match to one of acollection of known time stamp formats. If so, the event is consideredto have a time stamp from a known domain and extraction 330 isperformed. Otherwise, interpolation 340 is performed.

Time Stamp Extraction

If a known domain has been identified for an event, the event 315 istaken as input to a time stamp extraction step 330 where the time stampfrom the raw event data is extracted and passed with the event to theindexing process 220. In an exemplary implementation, this timestampextraction 330 occurs by iterating over potential time stamp formatpatterns from a dynamically ordered list in order to extract a time tobe recorded as the number of seconds that have passed since the Unixepoch (0 seconds, 0 minutes, 0 hour, Jan. 1, 1970 coordinated universaltime) not including leap seconds. Additionally, the implementation takesinto account time zone information and normalizes the times to a commonoffset. To increase performance, the ordering of this list is determinedusing a move-to-front algorithm, wherein whenever a match is found thematching pattern is moved to the beginning of the list. In such animplementation, the most frequently occurring patterns are checkedearliest and most often, improving performance. The move-to-front listsmay be maintained either for all time series data sources together, on aper-source basis (to take advantage of the fact that the formats in asingle source are likely to be similar), or in some other arrangement.

Time Stamp Interpolation

In the case where the event did not contain a time stamp from a knowndomain, then a timestamp is assigned to the event based on its context.In one implementation, the time stamp is linearly interpolated 340 fromthe time stamps of the immediately preceding and immediately followingevents 315 from the same time series data stream. If these events alsocontain no time stamps from a known domain, further earlier and/or laterevents can be used for the interpolation. The time stamp extractionmodule 330 automatically stores the time stamp of every hundredth event(or some other configurable period) from each time series data stream inorder to facilitate time stamp interpolation 340. In anotherimplementation, time stamps are interpolated 340 based on the timeassociated with the entire time series data stream 205 includingacquisition time, creation time or other contextual meta time data.

Indexing Process

Returning to FIG. 2 , in the indexing process 220, indexes are createdbased on incoming event data 215. The indexing process 220 organizes andoptimizes the set of indices in an online fashion as they are extendedwith more events. An example TSSE indexing process 220 is shown in FIG.5 and includes, in one implementation, several steps including bucketing510, segmenting 520, archival 530, allocation 540, insertion 550,committing to secondary storage 560, merging buckets in secondarystorage 570, and expiring buckets in secondary storage 580.

Time Bucketing

Events indexed by the TSSE are often queried, updated, and expired usingtime-based operators. By hashing the components of the index over a setof buckets organized by time, the efficiency and performance of theseoperators can be significantly improved. The final efficiency of thebucketing will, of course, depend on the hardware configuration, theorder in which the events arrive, and how they are queried, so there isnot a single perfect bucketing policy.

In one implementation, buckets with a uniform extent are used. Forexample, each time bucket can handle one hour's worth of data. Alternatepolicies might vary the bucket extents from one time period to another.For example, a bucketing policy may specify that the buckets for eventsfrom earlier than today are three hour buckets, but that the buckets forevents occurring during the last 24 hours are hashed by the hour. In theinformation processing example, a bucket might cover the period Jan. 15,2005 12:00:00 to Jan. 15, 2005 14:59:59. In order to improve efficiencyfurther, buckets are instantiated using a lazy allocation policy (i.e.,as late as possible) in primary memory (i.e., RAM). In-memory bucketshave a maximum capacity and, when they reach their limit, they will becommitted to disk and replaced by a new bucket. Bucket storage size isanother element of the bucketing policy and varies along with the sizeof the temporal extent. Finally, bucket policies typically enforce thatbuckets (a) do not overlap, and (b) cover all possible incoming timestamps.

Step 510 in indexing an event by time is to identify the appropriatebucket for the event based on the event's time stamp and the index'sbucketing policy. Each incoming event 215 is assigned 510 to the timebucket where the time stamp from the event matches the bucket's temporalcriteria. In one implementation, we use half-open intervals, defined bya start time and an end time where the start time is an inclusiveboundary and the end time is an exclusive boundary. We do this so thatevents occurring on bucket boundaries are uniquely assigned to a bucket.Following our example in the information processing environment, adatabase server event with the time stamp of Jan. 15, 2005 12:00:01might be assigned to the above-mentioned bucket.

Segmentation

Once an appropriate bucket has been identified 510 for an event, the rawevent data is segmented 520. A segment (also known as a token) is asubstring of the incoming event text and a segmentation 520 is thecollection of segments implied by the segmentation algorithm on theincoming event data. A segment sub string may overlap another substring,but if it does, it must be contained entirely within that substring. Weallow this property to apply recursively to the containing substring, sothat the segment hierarchy forms a tree on the incoming text.

In one implementation, segmentation 520 is performed by choosing twomutually exclusive sets of characters called minor breakers and majorbreakers. Whenever a breaking character, minor or major, is encounteredduring segmentation of the raw data, segments are emitted correspondingto any sequence of bytes that has at least one major breaker on one endof the sequence. For example, if, during segmentation, a minor breakingcharacter is found, then a segment corresponding to the sequence ofcharacters leading from the currently encountered minor breaker back tothe last major breaker encountered is recorded. If a major breaker wasencountered, then the sequence of characters leading back to either thelast major breaker or the last minor breaker, whichever occurred mostrecently, determines the next segment to be recorded.

Segmentation 520 rules describe how to divide event data into segments525 (also known as tokens). In one implementation a segmentation ruleexamines possible separators or punctuation within the event, forexample, commas, spaces or semicolons. An important aspect ofsegmentation is the ability to not only identify individual segments525, but also to identify overlapping segments. For example, the text ofan email address, “bob.smith@corp.com”, can be broken into individualand overlapping segments; <bob.smith>, <@> and <corp.com> can beidentified as individual segments, and <<bob.smith><@><corp.com>> canalso be identified as an overlapping segment. As described above, in oneimplementation, segmentation 520 uses a two-tier system of major andminor breaks. Major breaks are separators or punctuation that bound theouter most segment 525. Examples include spaces, tabs, and new lines.Minor breaks are separators or punctuation that break larger segmentsinto sub segments, for example periods, commas, and equal signs. In oneimplementation, more complex separators and punctuation combinations areused to handle complex segmentation tasks 520, for example handling Javaexceptions in an application server log file.

An example of segmentation in our information-processing example, IPaddresses could be broken down using white space as major breakers andperiods as minor breakers. Thus, the segments for the raw text“192.168.1.1” could be:

“192”

“192.168”

“192.168.1”

“192.168.1.1”

In another implementation, certain segments may represent known entitiesthat can be labeled and further understood algorithmically or by humanadded semantics. For example, in the above representation, “192.168.1.1”may be understood to be an IP address. Named entity extraction can bealgorithmically performed in a number of ways. In one implementation,the segment values or segment form from the same segment across multipleevents is compared to an entity dictionary of known values or knownforms.

In another implementation, entity extraction techniques are used toidentify semantic entities within the data. In one implementation,search trees or regular expressions can be applied to extract andvalidate, for example, IP addresses or email addresses. The goal ofextraction is to assist the segmentation process 520 and providesemantic value to the data.

Archiving and Indexing Events

At this point in the process, incoming events have time stamps 215,segments 525, and a time bucket 515 associated with them. To create thepersistent data structures that will be used later to perform lookups inthe search process, we store the raw data of the event with itssegmentation, create indices that map segments and time stamps tooffsets in the event data store, and compute and store metadata relatedto the indices.

Because the TSSE tolerates, in near real time, both the arrival of newevents and new searches, the system preferably is careful in managingaccess to disk. For the indexes, this is accomplished by splitting indexcreation into two separate phases: hot indexing and warm indexing. Hotindexes are managed entirely in RAM, are optimized for the smallestpossible insert time, are not searchable, and do not persist. “Warm”indexes are searchable and persistent, but immutable. When hot indexesneed to be made searchable or need to be persistent, they are convertedinto warm indexes.

In the implementation shown in FIG. 5 , a hot index 555 contains apacked array of segments, a packed array of event addresses and theirassociated time stamps, and a postings list that associates segmentswith their time stamped event addresses. For performance reasons, thepacked arrays can have hash tables associated with them to provide forquick removal of duplicates. When incoming events are being indexed,each segment of the event is tested for duplication using the segmentarray and its associated hash. The event address is also tested forduplication, against the event address array and its associated hash. Ifeither of the attributes is a duplicate, then the instance of thatduplicate that has already been inserted into the packed array is used.Otherwise, the new segment or event address is copied into theappropriate table 550 and the associated hash table is updated. Asevents are inserted into the hot index, the space associated with eachof the packed arrays gets used. A hot slice is considered to be “atcapacity” when one of its packed arrays fills up or when one of its hashtables exceeds a usage threshold (e.g., if more than half of the hashtable is in use). Once a hot index reaches capacity 540, it cannotaccept more segments for indexing. Instead it is converted to a warmindex, committed to disk 560, and replaced with a new empty hot index.

Another feature of this particular system is speculative indexing. Basedon earlier indexing processes, new time buckets can be initialized usingall or part of a representative, completed bucket as an exemplar. Inother words, by keeping around copies of data that may reasonably beexpected to occur in a time bucket, we can improve indexing performanceby speculatively initializing parts of the hot index. In one embodiment,the speculative indexing is performed by copying the packed array ofsegments and its associated hash table from an earlier hot index. Thehot slice is then populated as usual with the exception that the segmentarray is already populated and ready for duplicate testing. Because ofthe highly regular language and limited vocabulary of machines, the hitrate associated with this speculation can be very good.

The searching process (as described in the next section) allows the userto search on segments, segment prefixes, and segment suffixes. Toaccommodate these search types, in one implementation, the segmentsarray can be sorted and then stored as a blocked front coded lexicon(hereafter called “the forward lexicon”). This data structure makes itpossible to perform segment and segment prefix lookups efficiently whilestill achieving a reasonable amount of compression of the segment text.When a search is being performed on a particular segment, the offset ofthe segment in the forward lexicon is used as an efficient way to lookup metadata associated with the queried-for segment in other associatedtables.

To handle suffix lookups, a blocked front coded lexicon can be createdon the same collection of segments after they have been string-reversed(hereafter called “the reverse lexicon”). Also, a map is populated thatconverts the offset of a reversed segment in the reverse lexicon to theequivalent non-reversed segment's offset in the forward lexicon(hereafter called “the reverse-forward map”). When performing suffixlookups, the offset in the reverse lexicon is used as an offset into thereverse-forward map. The value stored at that position in the map is theappropriate offset to use for the other metadata arrays in the warmindex.

The warm index provides a list of event offsets for each segmentindexed, preferably in an efficient manner. In one implementation, thiscan be done by maintaining an array of compressed postings lists and anassociated array of offsets to the beginning of each of those compressedpostings lists. The postings lists are maintained in segment offsetorder, so when a lookup is performed, the segment ID can be used to findthe appropriate entry of the postings lists offsets array. The values inthe postings lists entries are the offsets that should be used to lookup events in the packed array of event addresses.

Finally, statistical metadata can be provided for each indexed segment(e.g., the first and last time of occurrence of the segment, the meaninter-arrival time, and the standard deviation of the inter-arrivaltime).

During the course of the indexing process, it is possible that a singletime bucket will be filled and committed to disk 560 several times. Thiswill result in multiple, independently searchable indices in secondarystorage for a single time span. In an exemplary implementation, there isa merging process 570 that takes as input two or more warm indices andmerges them into a single warm index for that time bucket. This is aperformance optimization and is not strictly required for searching.

Expiring Events

Furthermore, over a long period of time, it is possible that applyingthe indexing process 220 to time series data will cause a large amountof persistent data to accumulate. The indexing process, therefore,preferably contains an expiration process 580 that monitors the databasefor time buckets to be deleted based on user-provided preferences. Inone implementation, these preferences might include a trailing timewindow (“events older than 3 months need not be returned in searchresults”), a time range (“events earlier than January 1 of this yearneed not be returned in search results”), a maximum number of events(“no more than 1 million events need be returned in search results”), ora maximum total size for the index (“return as many useful searchresults as possible while consuming no more than 100 GB of Disk”). Aprocess periodically wakes up and tests the collection of warm slicesfor any slices that meet the expiration criterion. Upon expiration, awarm index file and its associated raw event data and segmentation ismoved out of the active index. The index file need not necessarily bedeleted. In one implementation, the index file could be streamed to lessexpensive offline storage.

Search Process

An example TSSE search process is shown in FIG. 6 and includes severalmethods for parsing 610 a search phrase, issuing multiple sub-searches625 in order to satisfy the incoming parent search, using sub-searchresults 635 to prune searches, and merging 640 sub-search results into afinal set of search results for presentation to the user.

Time Series Search Language

During search processing, incoming search phrases 255 are parsed 610according to a time series search language (TSSL) in order to generateannotated parse trees 615. An exemplary TSSL language syntax includes aseries of modifiers or commands taking the format name::value. Somemodifiers may have default values and some can only be used once, whilesome can appear several times in the same search with different values.Examples include the following:

-   -   average::value—calculate the average number of events using the        value time frame.    -   page::value—present search results by value. Value can be        seconds, minutes, hours, days, weeks or months or any other        metadata element, for example, source or event type.    -   count::—calculate the total number of for events.    -   daysago::value—search for events within the last value days.    -   index::value—the index to search-main, default, history, or        another index defined by the TSSE.    -   hoursago::value—search for events within the last value hours.    -   eventtype::value—search for events with an event type or tag        that matches the specified value.    -   host::value—search for events whose hostname was set to the        specified value. This is the host that logged the event, not        necessarily the host that generated the event.    -   maxresults::value—the maximum number ofresults to return.        minutesago::value—search for events within the last value        minutes.    -   related::value—search for events with segment values (e.g., 404        or username) matching one or more in the current event.    -   similar::value—search for events with a similar event type to        the current event.    -   sourcetype::value—search for events with a given sourcetype of        value.    -   unexpected::value—search for events that lie outside observed        patterns in the index by the specified value of 0 (expected) to        9 (most unexpected).

Modifiers can be combined with keywords, wildcard characters, literalstrings, quoted phrases and Boolean operators, such as AND, OR, NOT.Parentheses can be used to nest search and sub-search phrases together.An example search phrase might be “sourcetype::mysql*sock*NOT (startedOR (host::foo OR host::BAR)) maxresults::10 (eventtype::baddb OReventtype::?8512-3) daysago::30”.

In one implementation, a custom parser 610 handles the Boolean operators“NOT” and “OR” and defaults to “AND”. This implementation also handlesusing parentheses to disambiguate the language when there are severaloperators. Otherwise, it associates left-to-right. The implementationalso supports special search operators that are indicated using a domainspecifier followed by a demarcation element. For example, searching for“source::1234”, might indicate that the searcher (human or system) wantsto restrict results to events that were received from a particularsource ID.

Incoming search phrases may also trigger ad hoc computation 612 based ona map of special keywords. For example, a special search string might beused to indicate that a search is to be stored and reissued on aperiodic basis or to request a list of sources. In this case, the searchstring would be stored in a table on disk along with a schedulespecifying the schedule on which the search should be reissued.Depending on the results of the search when executed, additional actionsmay be triggered. For example, an email alert might be sent, an RSS feedmight be updated, or a user-supplied script might be executed. Anotherexample of a search that triggers ad hoc computation 612 is one that isindicated to be saved for later use, but not to be reissued on aperiodic basis.

Assuming that the search parser 610 determined that an annotated syntaxtree 615 should be created for the search string, the next component,the search execution engine 620 will use the annotated syntax tree 615to issue sub-searches 625 to the time bucketed indices 565. Eachsub-search 625 is targeted at an individual time bucket 565. Timebuckets are queried in the order that is most advantageous to pruninggiven the sort order for the results. For example, if search results aresorted in reverse chronological order, then the sub-search for the mostrecent time bucket will be issued first. This allows the searchexecution engine 620 to examine the results 635 of the sub-search beforeproceeding with additional (expensive) sub-searches 625. For example, ifa particular sub-search returns enough results 635, then it is notnecessary to proceed with additional sub-searches 625.

Once enough results sets 637 have been accumulated to satisfy the parentsearch, another module will take the results and merge 640 them into asingle result set 235, 237 that satisfies the search. This mergingprocess, in one implementation, performs a merge sort on the resultsfrom each of the buckets to keep them in the order required for thepresentation process.

Presentation Process

The final process in an exemplary implementation of our example TSSE isthe preparation of search results for presentation 240, as shown in FIG.7 . Unlike current large-scale search engines that presentnon-interactive results ordered by keyword relevance ranking, thisexample TSSE can present results organized by time, event relationships,and keyword relevance ranking.

Time Based Presentation

Unique to the challenge of indexing and searching time series data isthe presentation of results using time as a primary dimension 710.Because existing large-scale search engines do not organize informationby time, the presentation of time-based results is not a consideration.However, a primary benefit of a TSSE is the ability to index, search andpresent time series data chronologically. Results can be presented byaggregating and summarizing search results based on discrete time rangesor based on statistical calculations.

For example, the example TSSL can specify to see results for only aparticular time frame and/or to see results presented by seconds,minutes, hours, days, weeks or months. In this way the search window canbe limited to a timeframe and the results can be constructed for optimalviewing based on the density of the expected result set returned from asearch. The search “192.168.169.100 hoursago::24 page::seconds”, willreturn time series events including the keyword “192.168.169.100” thatoccurred within the last 24 hours and will summarize the display resultsby seconds. In an exemplary implementation of a TSSE, summarization caninclude both aggregated display lines summarizing the events for thesummary window and/or paging the results by the summary window. In theexample above, each page of the search results presentation may includeone second in time. Examples include but are not limited to:

-   -   Ability to scroll/page through the data (n) results at a time by        count.    -   Ability to scroll/page through the data by time: next/previous        second, minute, hour, day, year.    -   Ability to specify max count per timeframe.    -   Ability to get next (n) results within a paged time        frame—(within a second) get next 100.        Metadata Presentation

In addition to time-based presentation 710, an example TSSE preferablyis able to present additional aggregation and summarization of resultsby metadata characteristics 720, such as, data source, data source type,event type, or originating host machine. In this way, results can be notonly organized by time, but also refined by metadata aggregation andsummarization. The search “192.168.169.100 page::source” will presentall the results with “192.168.169.100” and put each data sourcecontaining results on a separate page. Examples include but are notlimited to:

-   -   Original physical location of the data source.    -   Original physical machine, sensor etc. generating the data.    -   Type of data source as dynamically assigned by the indexing        process.    -   Type of event as dynamically assigned by the indexing process.        Zoom Control

Because time and certain metadata parameters (e.g., machine IPaddresses) can be continuous, an example TSSE user interaction model caninclude the ability to move from small increments of time (seconds orminutes) or metadata parameters (different classes of IP addresses)using a zoom control 730. This zoom control can be combined with othermetadata search parameters to enable the rapid movement through largeamounts of data. Examples include but are not limited to:

-   -   Ability to zoom in and out around a given time from any        second(s) to minute(s), hour(s), etc.    -   Ability to zoom in to second resolution around 12:15 AM Jun. 3,        2005, for a specific data source type and physical machine        location.        Presentation Density Control

Given the different types of users (humans and systems) and the varyingtypes of time series data and events (e.g., single line events a fewbytes in size, to multiple line events several megabytes in size) it isuseful to be able to specify the density of the results. In oneimplementation the presentation density can be controlled 740 to returnand/or display only the raw data without any metadata in a simple ASCIItext format. Alternatively the same results can be returned and ordisplayed with full metadata as rich XML.

Implementation

The TSSE can be implemented in many different ways. In one approach,each box shown in the various figures is implemented in software as aseparate process. All of the processes can run on a single machine orthey can be divided up to run on separate logical or physical machines.In alternate embodiments, the invention is implemented in computerhardware, firmware, software, and/or combinations thereof. Apparatus ofthe invention can be implemented in a computer program product tangiblyembodied in a machine-readable storage device for execution by aprogrammable processor; and method steps of the invention can beperformed by a programmable processor executing a program ofinstructions to perform functions of the invention by operating on inputdata and generating output. The invention can be implementedadvantageously in one or more computer programs that are executable on aprogrammable system including at least one programmable processorcoupled to receive data and instructions from, and to transmit data andinstructions to, a data storage system, at least one input device, andat least one output device. Each computer program can be implemented ina high-level procedural or object-oriented programming language, or inassembly or machine language if desired; and in any case, the languagecan be a compiled or interpreted language. Suitable processors include,by way of example, both general and special purpose microprocessors.Generally, a processor will receive instructions and data from aread-only memory and/or a random access memory. Generally, a computerwill include one or more mass storage devices for storing data files;such devices include magnetic disks, such as internal hard disks andremovable disks; magneto-optical disks; and optical disks. Storagedevices suitable for tangibly embodying computer program instructionsand data include all forms of non-volatile memory, including by way ofexample semiconductor memory devices, such as EPROM, EEPROM, and flashmemory devices; magnetic disks such as internal hard disks and removabledisks; magneto-optical disks; and CD-ROM disks. Any of the foregoing canbe supplemented by, or incorporated in, ASICs (application-specificintegrated circuits) and other forms of hardware.

Therefore, although the detailed description contains many specifics,these should not be construed as limiting the scope of the invention butmerely as illustrating different examples and aspects of the invention.It should be appreciated that the scope of the invention includes otherembodiments not discussed in detail above. Various modifications,changes and variations which will be apparent to those skilled in theart may be made in the arrangement, operation and details of the methodand apparatus of the present invention disclosed herein withoutdeparting from the spirit and scope of the invention as defined in theappended claims. Therefore, the scope of the invention should bedetermined by the appended claims and their legal equivalents.

The invention claimed is:
 1. A method for machine data analysis,comprising: obtaining, by a computing device, a set of time-stampedevents, the time-stamped events of the set of time-stamped eventsrepresenting time-series machine data from a data source in aninformation technology environment; processing a time-based searchphrase, the time-based search phrase including a first command lineoperation, a second command line operation, and a time component,wherein the first command line operation includes a search phrase, andwherein the second command line operation includes a data modificationoperation; executing the first command line operation on the set oftime-stamped events to generate result data, wherein executing the firstcommand line operation causes searching of the time-stamped events usingthe search phrase; executing the second command line operation on theresult data, wherein executing the second command line operationincludes applying the data modification operation to the result data toproduce modified data; and causing display of information relating tothe modified data.
 2. The method of claim 1, further comprisingfiltering the set of time-stamped events using the time component,wherein said filtering identifies particular events of the set oftime-stamped events associated with a timestamp specified by the timecomponent.
 3. The method of claim 1, further comprising executing thefirst command line operation on one or more additional sets oftime-stamped events to produce a plurality of result data, wherein theset of time-stamped events and the one or more additional sets oftime-stamped events correspond to different time frames.
 4. The methodof claim 1, further comprising parsing the time-series machine data toproduce the set of time-stamped events, wherein each event from the setof time-stamped events includes a portion of the time-series machinedata.
 5. The method of claim 1, wherein the data source is a server. 6.The method of claim 1, wherein the time-series machine data reflectstransaction activity in the information technology environment.
 7. Themethod of claim 1, wherein the time-series machine data reflectsrecorded measurements.
 8. The method of claim 1, wherein each event inthe set of time-stamped events includes a portion of the time-seriesmachine data.
 9. The method of claim 1, wherein the result data reflectsa performance aspect of the information technology environment.
 10. Themethod of claim 1, wherein the result data reflects a security aspect ofthe information technology environment.
 11. One or more non-transitorycomputer-readable storage media, storing software instructions formachine data analysis, which when executed by one or more processorscause the one or more processors to: obtain, by a computing device, aset of time-stamped events, the time-stamped events of the set oftime-stamped events representing time-series machine data from a datasource in an information technology environment; process a time-basedsearch phrase, the time-based search phrase including a first commandline operation, a second command line operation, and a time component,wherein the first command line operation includes a search phrase, andwherein the second command line operation includes a data modificationoperation; execute the first command line operation on the set oftime-stamped events to generate result data, wherein execution of thefirst command line operation causes searching of the time-stamped eventsusing the search phrase; execute the second command line operation onthe result data, wherein to execute the second command line operation,the software instructions when executed cause the one or more processorsto apply the data modification operation to the result data to producemodified data; and cause display of information relating to the modifieddata.
 12. The one or more non-transitory computer-readable storage mediaof claim 11, wherein the software instructions which when executed byone or more processors further cause the one or more processors to:filter the set of time-stamped events using the time component, whereinfiltering the set of time-stamped events identifies particular events ofthe set of time-stamped events associated with a timestamp specified bythe time component.
 13. The one or more non-transitory computer-readablestorage media of claim 11, wherein the software instructions which whenexecuted by one or more processors further cause the one or moreprocessors to: execute the first command line operation on one or moreadditional sets of time-stamped events to produce a plurality of resultdata, wherein the set of time-stamped events and the one or moreadditional sets of time-stamped events correspond to different timeframes.
 14. The one or more non-transitory computer-readable storagemedia of claim 11, wherein the software instructions which when executedby one or more processors further cause the one or more processors to:parse the time-series machine data to produce the set of time-stampedevents, wherein each event from the set of time-stamped events includesa portion of the time-series machine data.
 15. The one or morenon-transitory computer-readable storage media of claim 11, wherein thetime-series machine data reflects transaction activity in theinformation technology environment.
 16. An apparatus for machine dataanalysis, comprising: one or more processors; and a memory storinginstructions, which when executed by the one or more processors, causethe one or more processors to: obtain a set of time-stamped events, thetime-stamped events of the set of time-stamped events representingtime-series machine data from a data source in an information technologyenvironment; process a time-based search phrase, the time-based searchphrase including a first command line operation, a second command lineoperation, and a time component, wherein the first command lineoperation includes a search phrase, and wherein the second command lineoperation includes a data modification operation; execute the firstcommand line operation on the set of time-stamped events to generateresult data, wherein executing the first command line operation causessearching of the time-stamped events using the search phrase; executethe second command line operation on the result data, wherein executingthe second command line operation includes applying the datamodification operation to the result data to produce modified data; andcause display of information relating to the modified data.
 17. Theapparatus of claim 16, wherein the instructions, which when executed bythe one or more processors, cause the one or more processors to: filterthe set of time-stamped events using the time component, whereinfiltering identifies particular events of the set of time-stamped eventsassociated with a time-stamp specified by the time component.
 18. Theapparatus of claim 16, wherein the instructions, which when executed bythe one or more processors, cause the one or more processors to: executethe first command line operation on one or more additional sets oftime-stamped events to produce a plurality of result data, wherein theset of time-stamped events and the one or more additional sets oftime-stamped events correspond to different time frames.
 19. Theapparatus of claim 16, wherein the instructions, which when executed bythe one or more processors, cause the one or more processors to: parsethe time-series machine data to produce the set of time-stamped events,wherein each event from the set of time-stamped events includes aportion of the time-series machine data.
 20. The apparatus of claim 16,wherein the time-series machine data reflects transaction activity inthe information technology environment.